import 'package:FiduMart/generated/json/base/json_convert_content.dart';
import 'package:FiduMart/core/network/model/mining_invest_list_entity.dart';

MiningInvestListEntity $MiningInvestListEntityFromJson(
    Map<String, dynamic> json) {
  final MiningInvestListEntity miningInvestListEntity = MiningInvestListEntity();
  final List<MiningInvestListList>? list = (json['list'] as List<dynamic>?)
      ?.map(
          (e) =>
      jsonConvert.convert<MiningInvestListList>(e) as MiningInvestListList)
      .toList();
  if (list != null) {
    miningInvestListEntity.list = list;
  }
  final int? systemTime = jsonConvert.convert<int>(json['systemTime']);
  if (systemTime != null) {
    miningInvestListEntity.systemTime = systemTime;
  }
  final int? page = jsonConvert.convert<int>(json['page']);
  if (page != null) {
    miningInvestListEntity.page = page;
  }
  final int? pageSize = jsonConvert.convert<int>(json['pageSize']);
  if (pageSize != null) {
    miningInvestListEntity.pageSize = pageSize;
  }
  final int? total = jsonConvert.convert<int>(json['total']);
  if (total != null) {
    miningInvestListEntity.total = total;
  }
  return miningInvestListEntity;
}

Map<String, dynamic> $MiningInvestListEntityToJson(
    MiningInvestListEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['list'] = entity.list?.map((v) => v.toJson()).toList();
  data['systemTime'] = entity.systemTime;
  data['page'] = entity.page;
  data['pageSize'] = entity.pageSize;
  data['total'] = entity.total;
  return data;
}

extension MiningInvestListEntityExt on MiningInvestListEntity {
  MiningInvestListEntity copyWith({
    List<MiningInvestListList>? list,
    int? systemTime,
    int? page,
    int? pageSize,
    int? total,
  }) {
    return MiningInvestListEntity()
      ..list = list ?? this.list
      ..systemTime = systemTime ?? this.systemTime
      ..page = page ?? this.page
      ..pageSize = pageSize ?? this.pageSize
      ..total = total ?? this.total;
  }
}

MiningInvestListList $MiningInvestListListFromJson(Map<String, dynamic> json) {
  final MiningInvestListList miningInvestListList = MiningInvestListList();
  final String? id = jsonConvert.convert<String>(json['id']);
  if (id != null) {
    miningInvestListList.id = id;
  }
  final String? miningId = jsonConvert.convert<String>(json['miningId']);
  if (miningId != null) {
    miningInvestListList.miningId = miningId;
  }
  final String? rate = jsonConvert.convert<String>(json['Rate']);
  if (rate != null) {
    miningInvestListList.rate = rate;
  }
  final int? cycle = jsonConvert.convert<int>(json['cycle']);
  if (cycle != null) {
    miningInvestListList.cycle = cycle;
  }
  final int? propNum = jsonConvert.convert<int>(json['propNum']);
  if (propNum != null) {
    miningInvestListList.propNum = propNum;
  }
  final String? totalIncome = jsonConvert.convert<String>(json['totalIncome']);
  if (totalIncome != null) {
    miningInvestListList.totalIncome = totalIncome;
  }
  final int? startTime = jsonConvert.convert<int>(json['startTime']);
  if (startTime != null) {
    miningInvestListList.startTime = startTime;
  }
  final int? endTime = jsonConvert.convert<int>(json['endTime']);
  if (endTime != null) {
    miningInvestListList.endTime = endTime;
  }
  final int? createdAt = jsonConvert.convert<int>(json['createdAt']);
  if (createdAt != null) {
    miningInvestListList.createdAt = createdAt;
  }
  final int? state = jsonConvert.convert<int>(json['state']);
  if (state != null) {
    miningInvestListList.state = state;
  }
  final double? amount = jsonConvert.convert<double>(json['amount']);
  if (amount != null) {
    miningInvestListList.amount = amount;
  }
  return miningInvestListList;
}

Map<String, dynamic> $MiningInvestListListToJson(MiningInvestListList entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['id'] = entity.id;
  data['miningId'] = entity.miningId;
  data['Rate'] = entity.rate;
  data['cycle'] = entity.cycle;
  data['propNum'] = entity.propNum;
  data['totalIncome'] = entity.totalIncome;
  data['startTime'] = entity.startTime;
  data['endTime'] = entity.endTime;
  data['createdAt'] = entity.createdAt;
  data['state'] = entity.state;
  data['amount'] = entity.amount;
  return data;
}

extension MiningInvestListListExt on MiningInvestListList {
  MiningInvestListList copyWith({
    String? id,
    String? miningId,
    String? rate,
    int? cycle,
    int? propNum,
    String? totalIncome,
    int? startTime,
    int? endTime,
    int? createdAt,
    int? state,
    double? amount,
  }) {
    return MiningInvestListList()
      ..id = id ?? this.id
      ..miningId = miningId ?? this.miningId
      ..rate = rate ?? this.rate
      ..cycle = cycle ?? this.cycle
      ..propNum = propNum ?? this.propNum
      ..totalIncome = totalIncome ?? this.totalIncome
      ..startTime = startTime ?? this.startTime
      ..endTime = endTime ?? this.endTime
      ..createdAt = createdAt ?? this.createdAt
      ..state = state ?? this.state
      ..amount = amount ?? this.amount;
  }
}